Skip to content

feat(lk): project resolution refactor, other UX#850

Open
rektdeckard wants to merge 2 commits into
mainfrom
tobias/better-confirm
Open

feat(lk): project resolution refactor, other UX#850
rektdeckard wants to merge 2 commits into
mainfrom
tobias/better-confirm

Conversation

@rektdeckard
Copy link
Copy Markdown
Member

  • Makes project resolution more deterministic
  • Adds Printer struct to make it easier to do file redirection, respect --quiet and --verbose flags globally, and to keep output from getting mixed in with debug information. Status messages and command outputs should not be printed manually with fmt functions from now on, and should instead use e.g. out.Status(), out.Result(), etc.
  • Improves UX of confirmations to make it harder to confuse yes/no:

BEFORE:
CleanShot 2026-05-28 at 00 43 36@2x
AFTER:
CleanShot 2026-05-28 at 00 43 54@2x

@rektdeckard rektdeckard requested review from a team, real-danm and yoonsio May 28, 2026 07:25
Copy link
Copy Markdown
Contributor

@Topherhindman Topherhindman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couple nits, but overall definitely a good improvement!

Comment thread cmd/lk/cloud.go

// poll for keys
fmt.Printf("Please confirm access by visiting:\n\n %s\n\n", authURL.String())
out.Statusf("Please confirm access by visiting:\n\n %s\n", authURL.String())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out.Statusf is --quiet-suppressed, so lk cloud auth -q i think would hide the verification URL, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, it doesn't print the URL -- but it does still open a browser window automatically if currently on an interactive terminal.

Comment thread pkg/util/printer_test.go
p.Warnf("warn %d", 1)
p.Resultf("result\n")

assert.Empty(t, "", err.String()[:0], "sanity")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this actually testing anything?

Comment thread cmd/lk/agent.go
}
if !silent {
fmt.Printf("Creating new agent deployment\n")
out.Status("Creating new agent deployment")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--silent and --quiet overlap here. these out.Status* calls already respect --quiet internally, but they're also wrapped in if !silent, so they're double gated, where as here its only gated by --quiet.

should we fold --silent's status suppression into --quiet and drop the if !silent wrappers?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good call. I'll just collapse these into one flag (--quiet). The cool thing about this is we almost don't need it at all, cuz now that everything happens on the expected FD you can do cmd > /dev/null 2>&1 to mimic silent, or cmd 2>/dev/null to suppress statuses.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still nice to have the flag for it tho

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants